/**
 * Created by Administrator on 2017/2/8 0008.*/

function getAreaCharacter(data){
	


var myChart=echarts.init(document.getElementById('location'));

var geoCoordMap = {
		"瓦房店":[121.979603,39.627114],
		"自贡":[104.778442,29.33903],
		"张家港":[120.555821,31.875428],
		"海北藏族自治州":[100.907395, 100.907395],
		"江阴":[120.26,31.91],
		"大同":[113.3,40.12],
		"德宏傣族景颇族自治州":[98.591429, 98.591429],
		"南通":[121.05,32.08],
		"包头":[110,40.58],
		"荣成":[122.41,37.16],
		"阿拉尔市":[81.287224, 81.287224],
		"常德":[111.69,29.05],
		"潜江":[112.906102, 112.906102],
		"湘西土家族苗族自治州":[109.745467, 109.745467],
		"十堰":[110.8046, 110.8046],
		"澳门":[113.549685, 113.549685],
		"五家渠市":[87.549966, 87.549966],
		"南昌":[115.89,28.68],
		"临沂":[118.35,35.05],
		"盘锦":[122.070714,41.119997],
		"潍坊":[119.1,36.62],
		"吉安":[114.972603, 114.972603],
		"林芝":[94.368122, 94.368122],
		"常熟":[120.74,31.64],
		"信阳":[114.099264, 114.099264],
		"鄂州":[114.901557, 114.901557],
		"广州":[113.23,23.16],
		"阜新":[121.676518, 121.676518],
		"阳泉":[113.57,37.85],
		"襄阳":[112.128326, 112.128326],
		"本溪":[123.73,41.3],
		"鸡西":[130.976161, 130.976161],
		"鹤岗":[130.304432, 130.304432],
		"兰州":[103.73,36.03],
		"库尔勒":[86.06,41.68],
		"周口":[114.703642, 114.703642],
		"邵阳":[111.474293, 111.474293],
		"揭阳":[116.35,23.55],
		"那曲":[92.0578, 92.0578],
		"鹤壁":[114.303874, 114.303874],
		"金华":[119.64,29.12],
		"安阳":[114.35,36.1],
		"东莞":[113.75,23.04],
		"南宁":[108.33,22.84],
		"阿里":[81.816089, 81.816089],
		"即墨":[120.45,36.38],
		"鞍山":[122.85,41.12],
		"长春":[125.35,43.88],
		"威海":[122.1,37.5],
		"太原":[112.53,37.87],
		"濮阳":[115.035917, 115.035917],
		"怀化":[110.008313, 110.008313],
		"莱州":[119.942327,37.177017],
		"盐城":[120.13,33.38],
		"山南":[91.765866, 91.765866],
		"随州":[113.386331, 113.386331],
		"眉山":[103.85507, 103.85507],
		"伊犁哈萨克自治州":[81.330806, 81.330806],
		"马鞍山":[118.48,31.56],
		"楚雄彝族自治州":[101.534573, 101.534573],
		"绍兴":[120.58,30.01],
		"葫芦岛":[120.836932,40.711052],
		"衢州":[118.88,28.97],
		"溧阳":[119.48,31.43],
		"洛阳":[112.44,34.7],
		"开封":[114.35,34.79],
		"吴江":[120.63,31.16],
		"吉林":[126.57,43.87],
		"诸暨":[120.23,29.71],
		"义乌":[120.06,29.32],
		"江门":[113.06,22.61],
		"大连":[121.62,38.92],
		"菏泽":[115.480656,35.23375],
		"广元":[105.849862, 105.849862],
		"徐州":[117.2,34.26],
		"文山壮族苗族自治州":[104.222129, 104.222129],
		"文登":[122.05,37.2],
		"九江":[115.97,29.71],
		"乐山":[103.77193, 103.77193],
		"宜昌":[111.3,30.7],
		"曲靖":[103.79,25.51],
		"荆州":[112.239741,30.335165],
		"拉萨":[91.11,29.97],
		"宜宾":[104.56,29.77],
		"胶南":[119.97,35.88],
		"招远":[120.38,37.35],
		"泰州":[119.9,32.49],
		"黄冈":[114.878882, 114.878882],
		"大理白族自治州":[100.274223, 100.274223],
		"萍乡":[113.861018, 113.861018],
		"丽江":[100.232887, 100.232887],
		"图木舒克市":[79.075436, 79.075436],
		"乌兰察布":[113.138484, 113.138484],
		"蓬莱":[120.75,37.8],
		"乌鲁木齐":[87.68,43.77],
		"株洲":[113.16,27.83],
		"海门":[121.15,31.89],
		"上饶":[117.950028, 117.950028],
		"日喀则":[88.887724, 88.887724],
		"呼和浩特":[111.65,40.82],
		"驻马店":[114.028713, 114.028713],
		"临汾":[111.5,36.08],
		"资阳":[104.634295, 104.634295],
		"昌都":[97.178747, 97.178747],
		"白城":[122.845222, 122.845222],
		"泰安":[117.13,36.18],
		"博尔塔拉蒙古自治州":[82.072686, 82.072686],
		"长沙":[113,28.21],
		"甘孜藏族自治州":[101.968756, 101.968756],
		"平顶山":[113.29,33.75],
		"克孜勒苏柯尔克孜自治州":[76.173156, 76.173156],
		"清远":[113.01,23.7],
		"三亚":[109.511909,18.252847],
		"日照":[119.46,35.42],
		"汕头":[116.69,23.39],
		"石嘴山":[106.39,39.04],
		"通化":[125.946506, 125.946506],
		"黑河":[127.534755, 127.534755],
		"宝鸡":[107.15,34.38],
		"通辽":[122.249677, 122.249677],
		"和田地区":[79.919524, 79.919524],
		"柳州":[109.4,24.33],
		"武汉":[114.31,30.52],
		"阳江":[111.95,21.85],
		"石河子市":[86.086822, 86.086822],
		"迪庆藏族自治州":[99.709476, 99.709476],
		"锦州":[121.15,41.13],
		"咸阳":[108.72,34.36],
		"白山":[126.429539, 126.429539],
		"景德镇":[117.184966, 117.184966],
		"香港":[114.177553, 114.177553],
		"邢台":[114.48,37.05],
		"咸宁":[114.328967, 114.328967],
		"绥化":[126.974956, 126.974956],
		"阿克苏地区":[80.269698, 80.269698],
		"昭通":[103.723311, 103.723311],
		"梅州":[116.1,24.55],
		"吴忠":[106.205181, 106.205181],
		"泸州":[105.39,28.91],
		"石家庄":[114.48,38.03],
		"济南":[117,36.65],
		"娄底":[112.001081, 112.001081],
		"韶关":[113.62,24.84],
		"遵义":[106.9,27.7],
		"晋中":[112.759366, 112.759366],
		"塔城地区":[82.993651, 82.993651],
		"茂名":[110.88,21.68],
		"莱芜":[117.67,36.19],
		"喀什地区":[76.000363, 76.000363],
		"泉州":[118.58,24.93],
		"东营":[118.49,37.46],
		"富阳":[119.95,30.07],
		"恩施土家族苗族自治州":[109.494765, 109.494765],
		"天门":[113.172529, 113.172529],
		"齐齐哈尔":[123.97,47.33],
		"承德":[117.93,40.97],
		"海西蒙古族藏族自治州":[97.376359, 97.376359],
		"德阳":[104.37,31.13],
		"阿拉善盟":[105.735357, 105.735357],
		"丹东":[124.37,40.13],
		"惠州":[114.4,23.09],
		"潮州":[116.63,23.68],
		"辽阳":[123.244792, 123.244792],
		"果洛藏族自治州":[100.251341, 100.251341],
		"益阳":[112.361737, 112.361737],
		"淮安":[119.15,33.5],
		"连云港":[119.16,34.59],
		"中卫":[105.203362, 105.203362],
		"北京":[116.46,39.92],
		"淄博":[118.05,36.78],
		"金昌":[102.188043,38.520089],
		"宿迁":[118.3,33.96],
		"牡丹江":[129.58,44.6],
		"大兴安岭地区":[124.716543, 124.716543],
		"胶州":[120.03336,36.264622],
		"肇庆":[112.44,23.05],
		"巴中":[106.75419, 106.75419],
		"黄南藏族自治州":[102.021685, 102.021685],
		"秦皇岛":[119.57,39.95],
		"阿勒泰地区":[88.139266, 88.139266],
		"上海":[121.48,31.22],
		"郑州":[113.65,34.76],
		"朔州":[112.439232, 112.439232],
		"唐山":[118.02,39.63],
		"宁波":[121.56,29.86],
		"克拉玛依":[84.77,45.59],
		"西宁":[101.74,36.56],
		"芜湖":[118.38,31.33],
		"阿坝藏族羌族自治州":[102.231186, 102.231186],
		"无锡":[120.29,31.59],
		"枣庄":[117.57,34.86],
		"桂林":[110.28,25.29],
		"岳阳":[113.09,29.37],
		"湛江":[110.359377,21.270708],
		"嘉兴":[120.76,30.77],
		"宜兴":[119.82,31.36],
		"汉中":[107.02971, 107.02971],
		"保定":[115.48,38.85],
		"延安":[109.47,36.6],
		"绵阳":[104.73,31.48],
		"运城":[111.004547, 111.004547],
		"乳山":[121.52,36.89],
		"张家口":[114.87,40.82],
		"沧州":[116.83,38.33],
		"营口":[122.18,40.65],
		"青岛":[120.33,36.07],
		"榆林":[109.741195, 109.741195],
		"湖州":[120.1,30.86],
		"孝感":[113.962364, 113.962364],
		"抚州":[116.364489, 116.364489],
		"南阳":[112.535007, 112.535007],
		"云浮":[112.02,22.93],
		"德州":[116.29,37.45],
		"合肥":[117.27,31.86],
		"扬州":[119.42,32.39],
		"固原":[106.249201, 106.249201],
		"广安":[106.639752, 106.639752],
		"珠海":[113.52,22.3],
		"许昌":[113.858331, 113.858331],
		"银川":[106.27,38.47],
		"晋城":[112.858338, 112.858338],
		"新乡":[113.933871, 113.933871],
		"佳木斯":[130.326829, 130.326829],
		"北海":[109.12,21.49],
		"辽源":[125.150425, 125.150425],
		"平度":[119.97,36.77],
		"长治":[113.08,36.18],
		"舟山":[122.207216,29.985295],
		"四平":[124.356844, 124.356844],
		"贵阳":[106.71,26.57],
		"乌海":[106.80059, 106.80059],
		"双鸭山":[131.165482, 131.165482],
		"吐鲁番地区":[89.196029, 89.196029],
		"攀枝花":[101.718637,26.582347],
		"临安":[119.72,30.23],
		"凉山彝族自治州":[102.273865, 102.273865],
		"永州":[111.619866, 111.619866],
		"仙桃":[113.429363, 113.429363],
		"鄂尔多斯":[109.781327,39.608266],
		"河源":[114.68,23.73],
		"常州":[119.95,31.79],
		"七台河":[131.009498, 131.009498],
		"杭州":[120.19,30.26],
		"聊城":[115.97,36.45],
		"忻州":[112.740834, 112.740834],
		"商洛":[109.92524, 109.92524],
		"深圳":[114.07,22.62],
		"温州":[120.65,28.01],
		"荆门":[112.205843, 112.205843],
		"伊春":[128.847685, 128.847685],
		"烟台":[121.39,37.52],
		"呼伦贝尔":[119.77221, 119.77221],
		"黄石":[115.045433, 115.045433],
		"西双版纳傣族自治州":[100.803465, 100.803465],
		"福州":[119.3,26.08],
		"天津":[117.2,39.13],
		"张家界":[110.479191,29.117096],
		"湘潭":[112.91,27.87],
		"海东":[102.110763, 102.110763],
		"成都":[104.06,30.67],
		"普洱":[100.97281, 100.97281],
		"哈密地区":[93.521899, 93.521899],
		"沈阳":[123.38,41.8],
		"滨州":[118.03,37.36],
		"巴音郭楞蒙古自治州":[86.152302, 86.152302],
		"莱西":[120.53,36.86],
		"佛山":[113.11,23.05],
		"廊坊":[116.7,39.53],
		"兴安盟":[122.044065, 122.044065],
		"南京":[118.78,32.04],
		"鹰潭":[117.075765, 117.075765],
		"昌吉回族自治州":[87.273865, 87.273865],
		"内江":[105.064878, 105.064878],
		"铜川":[109.11,35.09],
		"大庆":[125.03,46.58],
		"金坛":[119.56,31.74],
		"渭南":[109.5,34.52],
		"吕梁":[111.151114, 111.151114],
		"达州":[107.474504, 107.474504],
		"衡水":[115.72,37.72],
		"玉树藏族自治州":[97.098471, 97.098471],
		"寿光":[118.73,36.86],
		"红河哈尼族彝族自治州":[103.381879, 103.381879],
		"昆明":[102.73,25.04],
		"玉溪":[102.52,24.35],
		"漯河":[114.02323, 114.02323],
		"宜春":[114.423253, 114.423253],
		"昆山":[120.95,31.39],
		"锡林郭勒盟":[116.054141, 116.054141],
		"海口":[110.35,20.02],
		"嘉峪关":[98.289152,39.77313],
		"抚顺":[123.97,41.97],
		"章丘":[117.53,36.72],
		"商丘":[115.662797, 115.662797],
		"海南藏族自治州":[100.626891, 100.626891],
		"赣州":[114.94126, 114.94126],
		"保山":[99.168333, 99.168333],
		"怒江傈僳族自治州":[98.863184, 98.863184],
		"厦门":[118.1,24.46],
		"哈尔滨":[126.63,45.75],
		"铁岭":[123.732205, 123.732205],
		"松原":[124.831261, 124.831261],
		"遂宁":[105.599142, 105.599142],
		"临沧":[100.09524, 100.09524],
		"中山":[113.38,22.52],
		"新余":[114.923887, 114.923887],
		"太仓":[121.1,31.45],
		"雅安":[103.048945, 103.048945],
		"重庆":[106.54,29.59],
		"焦作":[113.21,35.24],
		"济源":[112.609183, 112.609183],
		"台州":[121.420757,28.656386],
		"郴州":[113.021311, 113.021311],
		"句容":[119.16,31.95],
		"西安":[108.95,34.27],
		"三门峡":[111.19,34.76],
		"安康":[109.03593, 109.03593],
		"邯郸":[114.47,36.6],
		"苏州":[120.62,31.32],
		"南充":[106.110698,30.837793],
		"衡阳":[112.578467, 112.578467],
		"巴彦淖尔":[107.394129, 107.394129],
		"延边朝鲜族自治州":[129.515473, 129.515473],
		"丽水":[119.92,28.45],
		"朝阳":[120.4573, 120.4573],
		"赤峰":[118.87,42.28],
		"济宁":[116.59,35.38],
		"汕尾":[115.375279,22.786211],
		"镇江":[119.44,32.2]
};

var convertData = function (data) {
    var res = [];
    for (var i = 0; i < data.length; i++) {
        var geoCoord = geoCoordMap[data[i].name];
        if (geoCoord) {
            res.push(geoCoord.concat(data[i].value));
        }
    }
    return res;
};

var option = {
    backgroundColor: '#404a59',
    visualMap: {
        min: 0,
        max: 500,
        splitNumber: 5,
        inRange: {
            color: ['#d94e5d','#eac736','#50a3ba'].reverse()
        },
        markPoint:{
            label:{
                emphasis:{
                    show:true

                }
            }
        },
        textStyle: {
            color: '#fff'
        }
    },
    legend:{
        show:true,
        x:'left',
        y:'bottom',
        padding:8,
        tooltip:{
            show:true
        }
    },
    geo: {
        map: 'china',
        label: {
            emphasis: {
                show: true,
                textStyle:{
                    color:'#ffffff',
                    fontSize:15
                }
            }
        },
        roam: true,
        itemStyle: {
            normal: {
                areaColor: '#323c48',
                borderColor: '#111'
            },
            emphasis: {
                areaColor: '#2a333d'
            }
        }
    },
    series: [{
        name: '读者地域分布',
        type: 'heatmap',
        coordinateSystem: 'geo',
        label:{
            emphasis:{
                show:true
            }
        },
        data: convertData(data
        
//           [ {name: "句容", value: 75},
//            {name: "北京", value: 79},
//            {name: "淄博", value: 85},
//            {name: "鞍山", value: 86},
//            {name: "溧阳", value: 86},
//            {name: "库尔勒", value: 86},
//            {name: "安阳", value: 90},
//            {name: "开封", value: 90}]
          )
    }]
};
myChart.setOption(option);
}